from zvms.util import *

Notice = Blueprint('Notice', __name__)

@Notice.route('/notice/<int:id>')
@Notice.route('/notice')
def get_ones_notice(id=None):
    if id is None:
        id = session.get('id')
        cls = session.get('cls')
    else:
        cls = get(f'/user/{id}')['result']['cls']
    return render_template('notice.html',
        personal=get(f'/notice/search?user={id}')['result'],
        cls=get(f'/notice/search?cls={cls}')['result'],
        school=get(f'/notice/search?school')['result']
    )